#include <string>
#include <ctype.h>

using namespace std;

class Solution
{
public:
	string sortSentence(string s)
	{
		string ret;
		string arr[10];
		int begin = 0;
		for (int i = 0; i < s.size(); ++i)
		{
			if (isdigit(s[i]))
			{
				string tmp;
				while (begin < i)
				{
					tmp.push_back(s[begin]);
					++begin;
				}
				arr[s[i] - '0'] = tmp;
				begin += 2;
			}
		}

		for (auto x : arr)
		{
			if (!x.empty())
			{
				ret += x;
				ret += " ";
			}
		}
		ret.erase(ret.end() - 1);
		return ret;
	}
};